<template>
  <el-input
    v-model="bindValue"
    :type="props.getType"
    :style="{
      maxWidth: defaultConfig.maxWidth + '%',
      minWidth: defaultConfig.minWidth + 'px',
    }"
    :disabled="defaultConfig.disabled"
    :placeholder="defaultConfig.placeholder"
    :autosize="defaultConfig.autosize"
  />
</template>

<script lang="ts" setup>
import { ref, inject } from 'vue';
import { anyObj } from '@/utils/indexType';
import { connectObj } from '@/utils/index';
const props = defineProps({
  getKey: {
    type: String,
    default: () => {
      return '';
    },
  },
  getValue: {
    type: String,
    default: () => {
      return '';
    },
  },
  getType: {
    type: String,
    default: () => {
      return '';
    },
  },
});

const defaultConfig = ref<any>({
  disabled: false,
  placeholder: '',
  maxWidth: '46',
  minWidth: '300',
  autosize: { minRows: 2, maxRows: 2 },
});

// @ts-ignore
const getSecond = inject<anyObj>('testConfig')[props.getKey].elIntConfig;

connectObj(defaultConfig.value, getSecond);

if (props.getType === 'textarea') console.log(defaultConfig.value);

const bindValue = getSecond[props.getValue];
</script>
